@tailwind base;
@tailwind components;
@tailwind utilities;

/* 黑夜模式CSS变量 */

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --card-bg: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.8);
}

.dark {
    --bg-primary: #1c1c1e;
    --bg-secondary: #2c2c2e;
    --text-primary: #ffffff;
    --text-secondary: #ebebf5;
    --border-color: #38383a;
    --card-bg: rgba(28, 28, 30, 0.8);
    --glass-bg: rgba(44, 44, 46, 0.8);
    --shadow-color: rgba(0, 0, 0, 0.4);
    --hover-bg: #3a3a3c;
    --accent-color: #0a84ff;
    --accent-hover: #007aff;
    --selected-bg: #48484a;
    --selected-text: #ffffff;
    --success-color: #30d158;
    --warning-color: #ffd60a;
    --error-color: #ff453a;
}


/* 自定义动画 */

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scale-in {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-fade-in {
    animation: fade-in 0.3s ease-out forwards;
}

.animate-fade-in-up {
    animation: fade-in-up 0.4s ease-out forwards;
}

.animate-scale-in {
    animation: scale-in 0.3s ease-out forwards;
}


/* 文本截断 */

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}


/* 主题切换优化 */

* {
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}


/* 防止布局偏移 */

html,
body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}


/* Apple风格玻璃效果 */

.glass-effect {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
}

.dark .glass-effect {
    background: rgba(44, 44, 46, 0.8);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}


/* 滚动条样式 */

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(156, 163, 175, 0.5);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(156, 163, 175, 0.7);
}

.dark ::-webkit-scrollbar-thumb {
    background: rgba(156, 163, 175, 0.4);
    border-radius: 3px;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: rgba(156, 163, 175, 0.6);
}


/* Apple风格卡片悬停效果 */

.card-hover {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.dark .card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.2);
}


/* Apple风格按钮悬停效果 */

.btn-hover {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-hover:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.dark .btn-hover:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}


/* Apple风格输入框焦点效果 */

.input-focus:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.dark .input-focus:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.3);
}


/* 加载动画 */

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

@keyframes pulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}


/* 弹跳动画 */

@keyframes bounce {
    0%,
    100% {
        transform: translateY(-25%);
        animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
    }
    50% {
        transform: translateY(0);
        animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
    }
}

.animate-bounce {
    animation: bounce 1s infinite;
}


/* 渐变背景 */

.gradient-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.gradient-bg-light {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}


/* 响应式字体 */

@media (max-width: 640px) {
    .text-responsive {
        font-size: 0.875rem;
    }
}

@media (min-width: 641px) {
    .text-responsive {
        font-size: 1rem;
    }
}


/* 自定义选择样式 */

::selection {
    background-color: #3b82f6;
    color: white;
}

::-moz-selection {
    background-color: #3b82f6;
    color: white;
}


/* Apple风格选择样式 */

.dark ::selection {
    background-color: var(--accent-color);
    color: #ffffff;
}

.dark ::-moz-selection {
    background-color: var(--accent-color);
    color: #ffffff;
}


/* Apple风格黑暗模式增强样式 */

.dark {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    min-height: 100vh;
}


/* Apple风格卡片增强 */

.dark .glass-effect {
    background: rgba(44, 44, 46, 0.8);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}


/* Apple风格按钮增强 */

.dark button {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 12px;
}

.dark button:hover {
    background-color: var(--hover-bg);
    transform: scale(1.02);
}


/* Apple风格输入框增强 */

.dark input,
.dark textarea,
.dark select {
    background-color: rgba(44, 44, 46, 0.8);
    border-color: var(--border-color);
    color: var(--text-primary);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.dark input:focus,
.dark textarea:focus,
.dark select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.3);
    background-color: rgba(44, 44, 46, 0.9);
}


/* Apple风格链接增强 */

.dark a {
    color: var(--accent-color);
    transition: color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.dark a:hover {
    color: var(--accent-hover);
}


/* Apple风格边框修复 */

.dark .border-gray-200 {
    border-color: var(--border-color) !important;
}

.dark .border-t.border-gray-200 {
    border-top-color: var(--border-color) !important;
}


/* Apple风格滚动条 */

.dark ::-webkit-scrollbar {
    width: 8px;
}

.dark ::-webkit-scrollbar-track {
    background: transparent;
}

.dark ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}